package com.cslg.ac.demo.entity.pet;

import com.cslg.ac.demo.util.string.StringUtil;

import java.util.Date;
import java.util.regex.Pattern;

public class PetCommon {
    private Integer id;
    private String name;
    private String type;
    private String  birthday;
    private Integer masterId;
    private Integer sterilize;
    private Integer kind;
    private String image;
    private Integer gender;


    public boolean inserValid(int nameMax,int nameMin,int typeLength){
        if(StringUtil.haveNullOrEmpty(name) || name.length() > nameMax || name.length() < nameMin){
            return false;
        }
        if(StringUtil.haveNullOrEmpty(type) || StringUtil.lengthAbove(type,typeLength)){
            return false;
        }
        if(sterilize != 0 && sterilize != 1){
            return false;
        }
        if(gender != 0 && gender != 1){
            return false;
        }
        String regex = "^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}";
        if(StringUtil.haveNullOrEmpty(birthday) || !Pattern.matches(regex,birthday)){
            return false;
        }

        return true;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getMasterId() {
        return masterId;
    }

    public void setMasterId(Integer masterId) {
        this.masterId = masterId;
    }

    public Integer getKind() {
        return kind;
    }

    public void setKind(Integer kind) {
        this.kind = kind;
    }

    public Integer getSterilize() {
        return sterilize;
    }

    public void setSterilize(Integer sterilize) {
        this.sterilize = sterilize;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
}
